package com.linq.cool.beauty.enums;

import lombok.Getter;

/**
 * @Author: linq
 * @Date: 2021/1/20 20:58
 * @Version 1.0
 */
@Getter
public enum OrderStateEnum {
    /**
     * 订单状态(0:待付款 1:待确认 2:待评价 3:已完成 4:无效订单 5 已关闭
     */
    WAIT_PAY(0, "待付款"),
    WAIT_CONFIRM(1, "待确认"),
    ALREADY_SIGN(2, "待评价"),
    FINISH(3, "已完成"),
    INVALID(4, "无效订单"),
    CLOSED(5, "已关闭"),
    ;

    private final Integer code;
    private final String msg;

    OrderStateEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static OrderStateEnum getStatusByCode(Integer code) {
        switch (code) {
            case 1:
                return WAIT_CONFIRM;
            case 2:
                return ALREADY_SIGN;
            case 3:
                return FINISH;
            case 4:
                return INVALID;
            case 5:
                return CLOSED;
            default:
                return WAIT_PAY;
        }
    }

}
